#测试个人中心
import time

from selenium.webdriver.common.by import By

from commond.Utils import ForumDriver
from Test.ForumLoginTest import Login
class ForumSelf:
    driver=""
    url=""
    def __init__(self):
        self.driver=ForumDriver.driver
        self.url="http://127.0.0.1:9580/index.html"
        self.driver.get(self.url)

    #个人中心里面所有的框都可以输入
    def Self_Test(self):

        #个人中心
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_settings").click()
        ForumDriver.getScreenshot()
        time.sleep(1)
        #我的帖子
        self.driver.find_element(By.CSS_SELECTOR,"#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_profile").click()
        ForumDriver.getScreenshot()
        #返回登陆页
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_logout").click()
        #重新登陆
        Login.Suc_Login()


Self=ForumSelf()